/*
 * FunctionStudy.cpp
 *
 *  Created on: Mar 31, 2013
 *      Author: HikaruZhang
 */

#include <iostream>
#include "parameterPass.h"
using namespace std;



int main(){

	int result = 0;
	int a = 5;
	int b = 3;
	result = additionByPointer(&a, &b);
	std::cout << result<<std:: endl;
	std::cout << "Passing by pointer, the variable a will become " << a<<std::endl;
	std::cout << "Passing by pointer, the variable b will become " << b << std::endl;
	result = additionByReference(a,b);
	std::cout << result<<std:: endl;
	std::cout << "Passing by reference, the variable a will become " <<a<<std::endl;
	std::cout << "Passing by reference, the variable a will become " <<b << std::endl;
	return 0;
}

int additionByPointer(int * a, int * b){
	int result;
	result = *a + *b;
	*a = *a + 1;
	*b = *b + 1;


	return result;
}


int additionByReference(int &a, int &b){
	int result;
	result = a + b;
	a++;
	b++;

	return result;
}
